#include <linux/sysfs.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kobject.h>
#include <linux/device.h>



//创建有class testcls

static  struct class *testcls = NULL ;

struct class * getTestCls(void)
{
	if( !testcls )
		testcls = class_create(THIS_MODULE, "testCls" );
	printk("HanJ  %s:%s , %x\n" , __FILE__ , __func__ , (unsigned long)testcls ) ;
	return testcls ;
}
EXPORT_SYMBIL_GPL(getTestCls) ;

static int __init my_init(void)
{	
	int ret = 0;
	getTestCls();
	printk("HanJ  %s:%s\n" , __FILE__ , __func__ ) ;
	return ret ;
}


static void __exit my_exit(void)
{
	printk("HanJ  %s:%s\n" , __FILE__ , __func__ ) ;
}

module_init(my_init);
module_exit(my_exit);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Your Name");
MODULE_DESCRIPTION("Example of using kernfs");

